function [V,L] = UpdateV(A, X, beta, alpha, mu, L, S, r)
[d,n]=size(X);
In = eye(n);
tS = S.^r;
Qs=(tS+tS')/2;
Ls=diag(sum(Qs))-Qs;
M = alpha*In + beta*Ls;

tmp = bsxfun(@times, X, L);
if d<n
    V=(tmp*M*X' + mu*eye(d))\(alpha*tmp*A');
else   
    V =alpha*tmp/(mu*In+M*X'*tmp)*A';
end  
    L = 2* sqrt((sum(V.*V,2)));
end
    

